/*import React from 'react';
import { Image, Text, View} from 'react-native';
import Styles from './Styles';
import {findNodeHandle,UIManager} from 'react-native';

export default class Page4 extends BaseComponent {
    static navigationOptions = {
        headerTitle: '购物车',//对页面的配置
        tabBarLabel: '购物车',
        tabBarIcon: ({focused})=>{
            if(focused){
                return (
                    <Image style={Styles.tabBarIcon} source={require('../../images/cart_fill.png')}/>
                );
            }
            return (
                <Image style={Styles.tabBarIcon} source={require('../../images/cart.png')}/>
            );
        },
    };

    onClick = ()=>{
        const handle = findNodeHandle(this.refs.text1);
        let bean = AttributeUtil.getAttribute(handle);
        bean.then(function(data){
            //处理得到的 data 数据
            data.x = 111;
            console.log("返回结果："+data.width);
            console.log("返回结果："+JsonUtil.mapToJson(JsonUtil.objToStrMap(data)));
        }).catch(function (error) {
            console.log(error);
        });
    };

    render() {
        const {navigate} = this.props.navigation;

        return (
            <View style={Styles.container}>
                <Text ref='text1' onPress={this.onClick.bind(this,"text1")}>购物车</Text>
            </View>
        );
    }
}*/


/*********************************************/
import React, { Component } from "react";
import { Modal, Text, TouchableHighlight, View,Image, ProgressBarAndroid, ActivityIndicator } from "react-native";
import Styles from './Styles';
import List_Movies from '../../components/List_Movies';
import {WebView} from "react-native-webview";
import Input_Main from '../../components/Input_Main';

export default class Page4 extends Component {
    static navigationOptions = {
        headerTitle: '购物车',//对页面的配置
        tabBarLabel: '购物车',
        tabBarIcon: ({focused})=>{
            if(focused){
                return (
                    <Image style={Styles.tabBarIcon} source={require('../../images/cart_fill.png')}/>
                );
            }
            return (
                <Image style={Styles.tabBarIcon} source={require('../../images/cart.png')}/>
            );
        },
    };

    state = {
        modalVisible: false,
        progressValue: 0,
    };

    setModalVisible(visible) {
        this.setState({ modalVisible: visible });
    }

    render() {
        return (
            <View style={{ marginTop: 22 }}>
                <Modal
                    animationType="slide"
                    transparent={false}
                    visible={this.state.modalVisible}
                    onRequestClose={() => {
                        alert("Modal has been closed.");
                    }}
                >
                    <View style={{ flex:1, marginTop: 22, }}>
                        <View style={{flex:1,justifyContent:'center',alignItems:'center'}}>
                            <Text>Hello World!</Text>

                            <TouchableHighlight
                                onPress={() => {
                                    this.setModalVisible(!this.state.modalVisible);
                                }}
                            >
                                <Text>Hide Modal</Text>
                            </TouchableHighlight>
                        </View>
                    </View>
                </Modal>

                <TouchableHighlight
                    onPress={() => {
                        this.setModalVisible(true);
                    }}
                    style={{marginBottom:22}}
                >
                    <Text>Show Modal</Text>
                </TouchableHighlight>

                <Input_Main/>
            </View>
        );
    }

    /*render() {
        return (
            <View style={{flex:1,backgroundColor:'#ccc'}}>
                {this.state.progressValue===1?
                    null:
                    <ProgressBarAndroid
                        styleAttr="Horizontal"
                        indeterminate={false}
                        progress={this.state.progressValue}
                    /> }

                <WebView
                    ref={'webView'}
                    startInLoadingState={true}
                    renderLoading={()=>{
                        return (
                            // 可以用progressBar代替方案
                            <ActivityIndicator size="large" color="#0000ff" />
                        );
                    }}
                    source={{ uri: 'https://www.baidu.com' }}
                    onLoadProgress={(e)=>{
                        this.setState({
                            progressValue:Math.round(e.nativeEvent.progress*100)/100,
                        });
                    }}
                    onMessage={this._onMessage.bind(this)}
                    onNavigationStateChange={()=>{
                        // 可以用于获取code来换取token
                        ShowToast('我跳转了onNavigationStateChange')
                    }}
                />
            </View>
        );
    }*/

    _onMessage = (data)=>{
        ShowToast('onMessage:'+String(data));
    };

    _sendMsg2Html = (msg)=>{
        this.refs.webView.postMessage('只能传递一个字符串类型的参数'+msg);
    };
}
